import thenFs from "then-fs";

async function getAllFile(){
    //await后面跟着promise，将promise转为返回值
    let r1 = await thenFs.readFile('./1.txt','utf8')
    console.log(r1)
}
async function block(){
    console.log('这里也会同步执行')
    //在第一个await开始异步
    let r2 = await new Promise((resolve,reject) => {
        setTimeout(() => {
            console.log('resolve')
            resolve('200')
        },2000)
    })
    console.log('这里会阻塞,r2=',r2)
}
getAllFile()
block()
console.log("这里调用block不会阻塞")
